<template>
  <el-container direction="vertical">
    <topBar :headCollapse="headCollapse"></topBar>
    <el-header style="height: 50px;">
      <el-menu :default-active="this.$route.path" class="el-menu-demo el-head-menu" mode="horizontal">
        <el-menu-item index="/works">
          <router-link to="/works?appId=7c5abb3a4eb145aca09af4a6253b0804" slot="title"><i class="el-icon-picture-outline"></i>摄影作品展</router-link>
        </el-menu-item>
        <el-menu-item index="/myVotes">
          <router-link to="/myVotes?appId=7c5abb3a4eb145aca09af4a6253b0804" slot="title"><i class="el-icon-tickets"></i>我的投票</router-link>
        </el-menu-item>
      </el-menu>
    </el-header>
    <el-container style="padding:10px 5vh;background-color: rgb(245, 247, 249);overflow: hidden;">
      <el-container style="position: relative;">
        <div class="el-header-collapse" :class="{spread:headCollapse}" @click="headCollapseEvt"></div>
        <el-main style="padding:0;overflow-x: hidden;">
          <transition name="fade-transform" mode="out-in">
            <router-view />
          </transition>
        </el-main>
      </el-container>
    </el-container>
  </el-container>
</template>

<style lang="scss">
</style>

<script>
  import {
    Menu,
    MenuItem,
    Submenu,
  } from 'element-ui';
  import topBar from "@/views/layout/topBar"; //顶栏（logo）
  export default {
    components: {
      'el-menu': Menu,
      'el-menu-item': MenuItem,
      'el-submenu': Submenu,
      topBar
    },
    data() {
      return {
        headCollapse: false
      };
    },
    methods: {
      headCollapseEvt() {
        this.headCollapse = !this.headCollapse;
      }
    }
  };
</script>
